home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
AMIGA
/
AMICUS
/
AMIBEST2.ADF
/
Best of AMICUS 2
/
Txt
/
txt.doc
< prev
next >
Wrap
Text File
|
1987-07-22
|
7KB
|
191 lines
txt.doc 1/7/87 22:25
AUTHOR: Ray Lance
11 Riverside Drive
New York, NY 10023
(212) 874-4760
PLINK RL CIS 76556,400 BIX rlance
Copyright (c) 1986, 1987 by Ray Lance
I finally got tired enough of fussing with various annoyingly different
document formats, so tried to write a (slightly at least) generalized
solution, and, thinking it might be useful to more than just myself, decided
to release it as public domain, freely redistributable software, `shareware'.
Distribution must be only of the whole arc file. Contributions cheerfully
accepted.
Source is Lattice, Aztec, and MSC compatible. Plain vanilla compiles/
links in all cases except for Amiga Lattice 3.03 -- I couldn't find a unique
predefined symbol not also used by 3.10, so you have to define "L303" either
in the source (where it's commented out now) or in the compile command line
(-dL303). Aztec executable is included as it's the smallest.
-----
USAGE: txt [options] input_filename [options] [output_filename] [options]
If the output_filename is not specified, it will be generated as
RAM:input_filename, minus any path. This produces the output much faster
than floppy-to-floppy.
The options may appear anywhere you remember which one(s) are wanted,
due to what I think is a kinda nifty little option processor (getopt(), q.v.,
in the source code).
-b Don't delete the previous character on backspace; let the hex 08
(backspace character) be handled by the -c option.
- Default (not specifying -b) is to delete the previous character
and discard this, the backspace character.
-c[n] Control characters (those below hex 20, except: backspace (0x08),
tab (0x09), formfeed (0x0c), and EOF (0x1a)) are omitted from the
output if n is not given or is 0, otherwise (n > 0, but not 255)
they are shoved up into the + 0x80 range for printing.
- Default (not specifying -c) processes them through as they were.
-d Remove doublespacing: delete every other immediately consecutive
line-ending. Needed to permit re-paragraphing of double-spaced
documents.
-f Don't remove extra formfeeds, but leave them under control of the -c
option above.
- Default (not specifying -f) is reduction of multiple formfeeds to
only one, to avoid spitting paper.
-h Don't specially handle item headers, let them be re-paragraphed.
- The default handling for item headers while re-paragraphing
retains their specially formatted look. An item header is defined
as the data between 2 identical lines consisting of only at least 4
identical characters, such as the Plink ---- and -----.
-p Reformat paragraphs to the current wordwrap line size. Used in con-
junction with the wordwrap option (-w).
A paragraph is defined as beginning when a line begins with a spacing
character as identified by isspace(): i.e., space, tab, formfeed, or
another line-ending character.
-r[n] n=0: change output line endings to carriage return only. Both
carriage return and linefeed will be generated if n>0 (MSDOS
convention).
- Default (not specifying -r), is Unix and AmigaDOS compatible:
linefeed only.
-s[n] Convert spaces to tabs when more than one space is used to get to a
tab column (spaced n apart); if n is not given or 0, n = 8.
-t[n] Tab spacing: convert tabs to spaces to align on columns n spaces
apart; if n is not given or 0, n = 8.
- Default (not specifying -t) processes them through as is: hex 09.
-w[n] Wordwrap after column n. If n is 0 or not given, n = 77 (for uEMACS).
The line is terminated after the first previous space or punctuation
as specified by ispunct(). If none of these is present in the line,
the line is terminated (\n) at column n+1. Additonally, for "pretti-
ness", if the first space is more than 10 characters from the end of
the line and there is a punctuation mark closer to the end of the
line, the punctuation will be selected to end the line.
254 is the maximum line width (wordwrap column #);
255, or -1, is used in all the options to mean the option was
NOT selected.
- Default (not selecting this option, -w) is to retain line endings
where they are encountered.
-z Don't treat ^Z as end-of-file; let it be handled by the -c option.
-x Kills the default stripping of hex 80 bits which occurs before any
of the above.
The options need not be separated by spaces, but each MUST be preceded by
the hyphen (-). The option characters are case sensitive (lowercase here).
-----
DIFFERENCES BETWEEN AMIGADOS AND MSDOS VERSIONS:
The default output path is RAM: in AmigaDos, whereas the first of
TMP\ or ARCTEMP\, if found in the Environment, is selected in MSDOS. If
neither is found, RAM: is rejected as a path by MSDOS and the user must then
give the entire path\filename.
The default output line-ending is both carriage return and linefeed
in MSDOS, rather than just linefeed, as in AMIGADOS or UNIX. Input line-
endings are always handled no matter where they come from or what environment
you're running in now.
AMIGADOS MSDOS
default: linefeed carriage return and linefeed
-r output return only delete return (output linefeed only)
-r9 output both cr/lf delete linefeed (output return)
These differences are reflected in the options listing given when
you call the program with no parameters or just a ? -- don't get confused
though when some shells interpret the ? as a filename wildcard and start
giving you one character filenames. (Anybody got a good explanation for
the resounding slowness of the Aztec version typeout of the options message?)
-----
SAMPLE USES:
OPTIONS Explanation
txt file DOS2DOS automatic conversion of line-endings only
txt -w-p log re-paragraph the day's Plink log to width 77 for
uEMACS or Brief.
txt -d-w-p fcc.txt re-paragraph the fcc.txt double-spaced text file
txt -w80 file Assure file has only 80 character lines for printing
txt -t-s3 prog.c Expand 8 char tabs to spaces coming in and change to
3 character tabs going out (source program from
uEMACS or XyWrite to be used in Brief)
txt -t3-s ram:prog.c prog.c Scoot it back from Brief to uEMACS.
-----
This thing has grown like topsy. I _WAS_ going to release it with
re-paragraphing for Christmas, but ideas kept coming. And bugs with them.
Oh well, so it goes.
Other ideas are welcome (I'm kinda tired of it right now, though, so
might not be real quick to make further changes). One thing that probably
ought to happen to it is, when we have a proper piping capability, to change
it to stdin/stdout and dispense with the file logic.
Ray Lance